﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace Drawing
{
    public class CEllipse : Shapes
    {
        //private int m_Width;
        //private int m_Height;

        //public int Width
        //{
        //    get { return m_Width; }
        //    set { m_Width = value; }
        //}

        //public int Height
        //{
        //    get { return m_Height; }
        //    set { m_Height = value; }
        //}

        public CEllipse(Point _StartupPosition, Point _LastPosition) : base(_StartupPosition, _LastPosition)
        {
            m_TypeColor = TypeColor.BORDER;
            m_Type = TypeShape.CIRCLE;
            m_Width = Math.Abs(m_LastPosition.X - m_StartupPosition.X);
            m_Height = Math.Abs(m_LastPosition.Y - m_StartupPosition.Y);

           // Set m_StartupPosition
            m_StartupPosition.Y = m_LastPosition.Y < m_StartupPosition.Y ? m_LastPosition.Y : m_StartupPosition.Y;
            m_StartupPosition.X = m_LastPosition.X < m_StartupPosition.X ? m_LastPosition.X : m_StartupPosition.X;
            Point _temp;

            //if (m_LastPosition.Y < m_StartupPosition.Y && m_LastPosition.X < m_StartupPosition.X)
            //{
            //    _temp = m_LastPosition;
            //    m_LastPosition = m_StartupPosition;
            //    m_StartupPosition = _temp;
            //}
        }

        public CEllipse(Point _StartupPosition, int _Width, int _Height)
            : base(_StartupPosition)
        {
            m_TypeColor = TypeColor.BORDER;
            m_Type = TypeShape.CIRCLE;
            m_Width = _Width;
            m_Height = _Height;
            m_LastPosition.X = m_Width + m_StartupPosition.X;
            m_LastPosition.Y = m_Height + m_StartupPosition.Y;
        }

        // Get Rectangle Of C# Default
        public override Rectangle GetRectangle()
        {
            return new Rectangle(m_StartupPosition, new Size(m_Width, m_Height));
        }

        public override float GetSupperficies()
        {
            return 3.14f * m_Width / 2 * m_Height / 2;
        }
    }
}
